﻿using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using ParamSettings;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RevitAddin.cmd
{
    [TransactionAttribute(TransactionMode.Manual)]
    [RegenerationAttribute(RegenerationOption.Manual)]
    public class modelDataTemplateCmd : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            string cableRealteTable = ParamManager.getParamValue(globalVar.pathParam, "cableRealteTable", "C:\\ProgramData\\Autodesk\\Revit\\Addins\\2020\\whdqh\\电缆联系表.csv");
            try
            {
                if (File.Exists(cableRealteTable))
                {
                    string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\电缆联系表.csv";
                    File.Copy(cableRealteTable, desktopPath, true);
                    MessageBox.Show("下载成功！");
                }
            }
            catch (Exception)
            {
            }
            return Result.Succeeded;
        }
    }
}
